<?php 
class Com_YixunAnalyzer extends SiteAnalyzer
{
    protected $url = '';
    public function __construct($url)
    {
        $this->url = $url;
        $this->site = Sites::model()->findByPk(1);
    }

    public function get_item_id()
    {
        if(preg_match('@/item-(\d+)\.html@i', $this->url ,$match))
            return $match[1];
        return '';
    }

    public function get_item_title()
    {
        if(preg_match('@<h1 class="xname" itemprop="name">(.+?)</h1>@is', $this->get_page_content() ,$match))
            return $match[1];
        return '';
    }

    public function get_item_intro()
    {
        return '';
    }

    public function get_item_price()
    {
        if(preg_match('@<i>&yen;</i>(\d+\.\d+)@', $this->get_page_content() ,$match))
            return floatval($match[1]);
        return 0;
    }

    public function get_item_imgs()
    {
        return null;
    }
}